# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=sugar-runner
pkgver=0.110.0
pkgrel=6
pkgdesc="Scripts to run Sugar"
arch=('loong64' 'x86_64')
url="https://sugarlabs.org/"
license=('GPL')
depends=('sugar' 'xorg-xinit' 'xorg-server-xephyr' 'xorg-xrandr')
makedepends=('gobject-introspection')
source=(https://download.sugarlabs.org/sources/sucrose/glucose/$pkgname/$pkgname-$pkgver.tar.xz
        0001-Python-3-port.patch)
sha256sums=('383db309d4444f4758892b57614ace47d7cc395fdf01d1894d3da94354ff6870'
            'f0969d827b5799d2f86f4e38dd4eae14ec1ee1b31b33ef0bb8c609185cb3eec6')

prepare() {
  cd $pkgname-$pkgver

  # https://github.com/sugarlabs/sugar-runner/pull/5
  patch -Np1 -i ../0001-Python-3-port.patch

  # Fix launch from the application menu
  echo 'Terminal=true' >>data/sugar-runner.desktop
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --libexecdir=/usr/lib
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
